@extends('admin.layouts.index')
@section('title', '我的订单记录')

@section('content')

<div class="row">
    <div class="col-md-12">
        <div class="card">
            <div class="card-body">
                <table class="table table-bordered">
                    <thead>
                        <tr>
                            <th scope="col">产品名称</th>
                            <th scope="col">金额</th>
                            <th scope="col">状态</th>
                            <th scope="col">支付方式</th>
                            <th scope="col">开始时间</th>
                            <th scope="col">结束时间</th>
                            <th scope="col">操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        @forelse($orders as $order)
                        <tr>
                            <td>{{ $order->name }}</td>
                            <td>¥{{ $order->price }}</td>
                            @if($order->pay_status == 1)
                            <td class="text-primary">未支付</td>
                            @elseif($order->pay_status == 2)
                            <td class="text-primary">待支付</td>
                            @elseif($order->pay_status == 3)
                            <td class="text-success">已支付</td>
                            @elseif($order->pay_status == 4)
                            <td class="text-success">已续费</td>
                            @else
                            <td class="text-danger">已退款</td>
                            @endif
                            <td>{{ $order->type == 1 ? "微信支付" : "支付宝支付"  }}</td>
                            <td>{{ empty($order->start_time) ? "-" : date("Y-m-d H:i:s",$order->start_time) }}</td>
                            <td>{{ empty($order->end_time) ? "-" : date("Y-m-d H:i:s",$order->end_time) }}</td>
                            <td>
                                @if($order->pay_status == 2 && (time()-$order->start_time) <= 3600)
                                <a href="{{ url('/admin/prices/products_lists_repay',['id'=>$order->id]) }}">前往支付</a>
                                @endif
                            </td>
                        </tr>
                        @empty
                        <tr>
                            <td>暂无用户数据</td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                            <td></td>
                        </tr>
                        @endforelse
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

@endsection
